/*
 * Classname IServiceOException
 *
 * Version information
 *
 * Date 06-02-06
 *
 * Copyright (c) AmSoft Systems, 2006
 */

package net.amsoft.iservice.util.exception;

import net.amsoft.iservice.util.IServiceConstants;
import org.apache.log4j.Logger;


public class IServiceException extends Exception {
    private static final long serialVersionUID = 1L;

	private int iErrorCode;

    //default is user exception
    private boolean bExceptionTypeFlag = true;

    public IServiceException() {
        super();
    }

    public IServiceException(int iErrorCode) {
        this(IServiceConstants.getError(iErrorCode), iErrorCode);
    }

    public IServiceException(String message, int iErrorCode) {
        super(message);
        this.iErrorCode = iErrorCode;
    }

    public IServiceException(String message, int errorCode,
            boolean errorTypeFlag) {
        super(message);
        this.iErrorCode = errorCode;
        this.bExceptionTypeFlag = errorTypeFlag;
    }

    public String getMessage() {
        return super.getMessage();
    }
    public String toString() {
        return super.toString();
    }
    public int getErrorCode() {
        return iErrorCode;
    }
    public IServiceException(int errorCode, boolean errorTypeFlag) {
        this(IServiceConstants.getError(errorCode), errorCode);    
        this.bExceptionTypeFlag = errorTypeFlag;
    }
    
    public IServiceException(Logger oLogger, int errorCode) {
        this(IServiceConstants.getError(errorCode), errorCode);    
        oLogger.warn(" Exception : "+this.getMessage());
    }    
}
